/*
package com.mykt.gateway.config.properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import reactor.core.publisher.Mono;

@Configuration
public class CustomWebFilterConfig {
    @Bean
    public WebFilter webFilter() {
        return (exchange, chain) -> {
            ServerHttpRequest request = exchange.getRequest();
            ServerHttpResponse response = exchange.getResponse();

            // 获取请求路径
            String requestPath = request.getURI().getPath();
            String remoteAddress = request.getRemoteAddress().getAddress().getHostAddress();

            if (requestPath.startsWith("/actuator")) {
                // 如果请求路径以 /actuator 开头，返回 "Access Denied"
                response.setStatusCode(HttpStatus.FORBIDDEN);
                return response.writeWith(Mono.just(response.bufferFactory().wrap("Access Denied".getBytes())));
            } else {
                // 否则，继续执行过滤器链
                return chain.filter(exchange);
            }
        };
    }

}
*/
